#!/usr/bin/python
# -*- coding: UTF-8 -*-

from django.contrib.sitemaps import Sitemap
from django.urls import reverse
from app01.models import Book


class BlogSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    # def items(self):
    #     return Book.objects.filter(is_draft=False)
    def items(self):
        # return 返回一个列表，内容是urls中的name
        return ['app01:index', 'testdb']
        # return ['main', 'about', 'license']

    # def lastmod(self, obj):
    #     return obj.pub_date
    #
    def location(self, item):
        return reverse(item)
